<?php
/**
 * 后台菜单配置
 *
 */
use think\Session;
//代理商身份（0，品牌商，1.城市运营商，2.城市合伙人，3.员工）
//var_dump(Session::get('yoshop_agent.agent'));
$agentInfo=Session::get('yoshop_agent.agent');
//var_dump($agentInfo);
if($agentInfo['type']==0){
    //品牌商，提现
    $config['cash']=[
        [
            'name' => '提现管理',
            'index' => 'cash.cash/index',
            'uris' => [
                'cash.cash/index',
                'cash.cash/add'
            ]
        ],
        [
            'name' => '代理提现管理',
            'index' => 'cash.agentcash/indexagent',
            'uris' => [
                'cash.agentcash/index',
                'cash.agentcash/check',
            ]
        ],
    ];

    $config['submenu']= [
        [
            'name' => '城市运营商管理',
            'index' => 'agent.operator/index',
            'uris' => [
                'agent.operator/index',
                'agent.operator/add',
                'agent.operator/edit',
                'agent.operator/delete',
            ]
        ],
        [
            'name' => '合伙人管理管理',
            'index' => 'agent.partner/index',
            'uris' => [
                'agent.partner/index',
                'agent.partner/add',
                'agent.partner/edit',
                'agent.partner/delete',
            ]
        ],
        [
            'name' => '员工管理',
            'index' => 'agent.user/index',
            'uris' => [
                'agent.user/index',
                'agent.user/add',
                'agent.user/edit',
                'agent.user/delete',
            ]
        ],
        [
            'name' => '代理收入',
            'active' => true,
            'submenu' => [
                [
                    'name' => '代理分红',
                    'index' => 'agent.agent/rivide',
                ],
                [
                    'name' => '代理收入流水',
                    'index' => 'agent.agent/getmoney',
                ]
            ]

        ],
    ];
    return [
        'index' => [
            'name' => '数据统计',
            'icon' => 'icon-daohang',
            'index' => 'index.index/index',
            'submenu' =>[]
        ],
        'agent' => [
            'name' => '代理管理',
            'icon' => 'icon-daohang',
            'index' => 'agent.partner/index',
            'submenu' =>$config['submenu']
        ],
        'cash'=>[
            'name' => '提现管理',
            'icon' => 'icon-daohang',
            'index' => 'cash.cash/index',
            'submenu' =>$config['cash']
        ],
        'customer'=>[
            'name' => '商户管理',
            'icon' => 'icon-daohang',
            'index' => 'customer.customer/index',
            'submenu' =>[
                [
                    'name' => '商户列表',
                    'index' => 'customer.customer/index',
                    'uris' => [
                        'customer.customer/add',
                    ]
                ],
                [
                    'name' => '商户',
                    'active' => true,
                    'submenu' => [
                        [
                            'name' => '商户收入',
                            'index' => 'customer.customer/revenue',
                        ],
                        [
                            'name' => '商户订单',
                            'index' => 'customer.customer/water',
                        ]
                    ]

                ],
            ]
        ],
        'wxconfig'=>[
            'name' => '小程序设置',
            'icon' => 'icon-daohang',
            'index' => 'wxconfig.wxconfig/index',
            'uris' => [
                'agent.routine/index',
                'agent.routine/add'
            ]
        ],
        /*'help'=>[
            'name' => '帮助中心设置',
            'icon' => 'icon-daohang',
            'index' => 'help.help/index',
            'uris' => [
                'agent.routine/index',
                'agent.routine/add'
            ]
        ],*/
    ];
}elseif ($agentInfo['type']==1){
    //运营商  level为1表示为个人身份 2 为企业身份
    return [
        'index' => [
            'name' => '数据统计',
            'icon' => 'icon-daohang',
            'index' => 'index.index/index',
            'submenu' =>[]
        ],
        'agent' => [
            'name' => '代理管理',
            'icon' => 'icon-daohang',
            'index' => 'agent.partner/index',
            'submenu' =>[
                [
                    'name' => '合伙人管理',
                    'index' => 'agent.partner/index',
                    'uris' => [
                        'agent.partner/index',
                        'agent.partner/add',
                        'agent.partner/edit',
                        'agent.partner/delete',
                    ]
                ],
                [
                    'name' => '员工管理',
                    'index' => 'agent.user/index',
                    'uris' => [
                        'agent.user/index',
                        'agent.user/add',
                        'agent.user/edit',
                        'agent.user/delete',
                    ]
                ],
                [
                    'name' => '代理收入',
                    'active' => true,
                    'submenu' => [
                        [
                            'name' => '代理分红',
                            'index' => 'agent.agent/rivide',
                        ],
                        [
                            'name' => '代理收入流水',
                            'index' => 'agent.agent/getmoney',
                        ]
                    ]

                ],
            ]
        ],
        'cash'=>[
            'name' => '提现管理',
            'icon' => 'icon-daohang',
            'index' => 'cash.cash/index',
            'submenu' =>[
                [
                    'name' => '提现管理',
                    'index' => 'cash.cash/index',
                    'uris' => [
                        'cash.cash/index',
                        'cash.cash/add'
                    ]
                ],
            ]
        ],
        'customer'=>[
            'name' => '商户管理',
            'icon' => 'icon-daohang',
            'index' => 'customer.customer/index',
            'submenu' =>[
                [
                    'name' => '商户列表',
                    'index' => 'customer.customer/index',
                    'uris' => [
                        'customer.customer/add',
                    ]
                ],
                [
                    'name' => '商户',
                    'active' => true,
                    'submenu' => [
                        [
                            'name' => '商户收入',
                            'index' => 'customer.customer/revenue',
                        ],
                        [
                            'name' => '商户订单',
                            'index' => 'customer.customer/water',
                        ]
                    ]

                ],

            ]
        ]
    ];

}elseif ($agentInfo['type']==2){

    return [
        'index' => [
            'name' => '数据统计',
            'icon' => 'icon-daohang',
            'index' => 'index.index/index',
            'submenu' =>[]
        ],
        'cash'=>[
            'name' => '提现管理',
            'icon' => 'icon-daohang',
            'index' => 'cash.cash/index',
            'submenu' =>[
                [
                    'name' => '提现管理',
                    'index' => 'cash.cash/index',
                    'uris' => [
                        'cash.cash/index',
                        'cash.cash/add'
                    ]
                ],
            ]
        ],
        'customer'=>[
            'name' => '商户管理',
            'icon' => 'icon-daohang',
            'index' => 'customer.customer/index',
            'submenu' =>[
                [
                    'name' => '商户列表',
                    'index' => 'customer.customer/index',
                    'uris' => [
                        'customer.customer/add',
                    ]
                ],
                [
                    'name' => '商户',
                    'active' => true,
                    'submenu' => [
                        [
                            'name' => '商户收入',
                            'index' => 'customer.customer/revenue',
                        ],
                        [
                            'name' => '商户订单',
                            'index' => 'customer.customer/water',
                        ]
                    ]
                ],
            ]
        ]
    ];

}else{
    return [
        'index' => [
            'name' => '数据统计',
            'icon' => 'icon-daohang',
            'index' => 'index.index/index',
            'submenu' =>[]
        ],
        'customer'=>[
            'name' => '商户管理',
            'icon' => 'icon-daohang',
            'index' => 'customer.customer/index',
            'submenu' =>[
                [
                    'name' => '商户列表',
                    'index' => 'customer.customer/index',
                    'uris' => [
                        'customer.customer/add',
                    ]
                ],
                [
                    'name' => '商户',
                    'active' => true,
                    'submenu' => [
                        [
                            'name' => '商户收入',
                            'index' => 'customer.customer/revenue',
                        ],
                        [
                            'name' => '商户订单',
                            'index' => 'customer.customer/water',
                        ]
                    ]
                ],
            ]
        ]
    ];
}

